package com.tsd.jxc.goods.vo;

import com.tsd.core.utils.HlpUtils;
import com.tsd.jxc.goods.entity.JxcGoodsExt;
import com.tsd.jxc.goods.entity.JxcGoodsPriceExt;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: JxcGoodsImportVo
 * @Description: TODO
 * @Author: Hillpool
 * @Date: 2024/5/8 9:08
 * @Version: 1.0
 */
public class JxcGoodsImportVo {

    private String category_sid;

    private String parent_category_name;

    private String category_name;

    private String goods_sid;

    private String price_sid;

    private String code;

    private String name;

    private String spec;

    private String model;

    private String short_name;

    private String search_code;

    private String unit_name;

    private Integer qty;

    private BigDecimal buy_price;

    private BigDecimal min_sale_price;

    private BigDecimal sale_price;

    private BigDecimal price1;

    private BigDecimal price2;

    private BigDecimal price3;

    private BigDecimal stock_price;

    private BigDecimal stock_qty;

    private String note_info;

    private Integer index;

    private Integer empty_base;

    public String getCategory_sid() {
        return category_sid;
    }

    public void setCategory_sid(String category_sid) {
        this.category_sid = category_sid;
    }

    public String getParent_category_name() {
        return parent_category_name;
    }

    public void setParent_category_name(String parent_category_name) {
        this.parent_category_name = parent_category_name;
    }

    public String getCategory_name() {
        return category_name;
    }

    public void setCategory_name(String category_name) {
        this.category_name = category_name;
    }

    public String getGoods_sid() {
        return goods_sid;
    }

    public void setGoods_sid(String goods_sid) {
        this.goods_sid = goods_sid;
    }

    public String getPrice_sid() {
        return price_sid;
    }

    public void setPrice_sid(String price_sid) {
        this.price_sid = price_sid;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getShort_name() {
        return short_name;
    }

    public void setShort_name(String short_name) {
        this.short_name = short_name;
    }

    public String getSearch_code() {
        return search_code;
    }

    public void setSearch_code(String search_code) {
        this.search_code = search_code;
    }

    public String getUnit_name() {
        return unit_name;
    }

    public void setUnit_name(String unit_name) {
        this.unit_name = unit_name;
    }

    public Integer getQty() {
        return qty;
    }

    public void setQty(Integer qty) {
        this.qty = qty;
    }

    public BigDecimal getBuy_price() {
        return buy_price;
    }

    public void setBuy_price(BigDecimal buy_price) {
        this.buy_price = buy_price;
    }

    public BigDecimal getMin_sale_price() {
        return min_sale_price;
    }

    public void setMin_sale_price(BigDecimal min_sale_price) {
        this.min_sale_price = min_sale_price;
    }

    public BigDecimal getSale_price() {
        return sale_price;
    }

    public void setSale_price(BigDecimal sale_price) {
        this.sale_price = sale_price;
    }

    public BigDecimal getPrice1() {
        return price1;
    }

    public void setPrice1(BigDecimal price1) {
        this.price1 = price1;
    }

    public BigDecimal getPrice2() {
        return price2;
    }

    public void setPrice2(BigDecimal price2) {
        this.price2 = price2;
    }

    public BigDecimal getPrice3() {
        return price3;
    }

    public void setPrice3(BigDecimal price3) {
        this.price3 = price3;
    }

    public BigDecimal getStock_qty() {
        return stock_qty;
    }

    public void setStock_qty(BigDecimal stock_qty) {
        this.stock_qty = stock_qty;
    }

    public BigDecimal getStock_price() {
        return stock_price;
    }

    public void setStock_price(BigDecimal stock_price) {
        this.stock_price = stock_price;
    }

    public String getNote_info() {
        return note_info;
    }

    public void setNote_info(String note_info) {
        this.note_info = note_info;
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }

    public Integer getEmpty_base() {
        return empty_base;
    }

    public void setEmpty_base(Integer empty_base) {
        this.empty_base = empty_base;
    }

    public JxcGoodsExt convert2Goods() {
        JxcGoodsExt goodsExt = new JxcGoodsExt();
        goodsExt.setCategory_sid(this.getCategory_sid());
        goodsExt.setCode(this.getCode());
        goodsExt.setName(this.getName());
        goodsExt.setSpec(this.getSpec());
        goodsExt.setModel(this.getModel());
        goodsExt.setShort_name(this.getShort_name());
        goodsExt.setSearch_code(this.getSearch_code());
        goodsExt.setNote_info(this.getNote_info());
        return goodsExt;
    }

    public JxcGoodsPriceExt convert2GoodsPrice(JxcGoodsPriceExt priceExt) {
        if (priceExt == null) {
            priceExt = new JxcGoodsPriceExt();
            priceExt.setSn(99999);
        }
        priceExt.setUnit_name(this.getUnit_name());
        priceExt.setQty(this.getQty());
        priceExt.setBuy_price(this.getBuy_price());
        priceExt.setMin_sale_price(this.getMin_sale_price());
        priceExt.setSale_price(this.getSale_price());
        priceExt.setPrice1(this.getPrice1());
        priceExt.setPrice2(this.getPrice2());
        priceExt.setPrice3(this.getPrice3());
        return priceExt;
    }

    public String getCategory_info() {
        List<String> nameList = new ArrayList<>();
        if (!HlpUtils.isEmpty(this.getParent_category_name())) {
            nameList.add(this.getParent_category_name());
        }
        if (!HlpUtils.isEmpty(this.getCategory_name())) {
            nameList.add(this.getCategory_name());
        }
        return StringUtils.join(nameList, "-");
    }

    public String getGoods_info() {
        List<String> nameList = new ArrayList<>();
        if (!HlpUtils.isEmpty(this.getCode())) {
            nameList.add("编码：" + this.getCode());
        }
        if (!HlpUtils.isEmpty(this.getName())) {
            nameList.add("名称：" + this.getName());
        }
        if (!HlpUtils.isEmpty(this.getSpec())) {
            nameList.add("规格：" + this.getSpec());
        }
        if (!HlpUtils.isEmpty(this.getModel())) {
            nameList.add("型号：" + this.getModel());
        }
        return "【" + StringUtils.join(nameList, "，") + "】";
    }
}
